package com.lanju.controller;

import java.util.Map;
import java.util.UUID;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lanju.common.SpringUtils;
import com.lanju.entity.User;
import com.lanju.service.JedisService;
import com.lanju.service.RecomService;

@Controller
@RequestMapping("/recom")
public class recomController {
	private static final Logger LOGGER = LoggerFactory
            .getLogger(recomController.class);
    @Autowired
    RecomService recomService;
    
    @Resource
   	JedisService jedisService;
    
    @RequestMapping("/insertRecommed")
    @ResponseBody
    public Map<String, Object> insertRecommed(HttpServletRequest request,HttpSession session){
    	Map<String, Object> param = SpringUtils.getParameterMap(request);
    	User user =(User) session.getAttribute("userModel");
    	param.put("oldUserId", user.getUserId());
    	//param.put("oldUserId", "92732017-59d8-4572-8dcd-65c827779a4d");
    	param.put("id", UUID.randomUUID().toString());
        return recomService.insertRecommed(param);
        
    }
   
}

